<%--
  Created by IntelliJ IDEA.
  User: l
  Date: 2022/5/24
  Time: 17:20
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@include file="menu.jsp"%>
<!--/sidebar-->
<div class="main-wrap">

    <div class="crumb-wrap">
        <div class="crumb-list"><i class="icon-font"></i><a href="admin_index.jsp">首页</a><span class="crumb-step">&gt;</span><span class="crumb-name">订单管理</span></div>
    </div>
    <div class="search-wrap">
        <div class="search-content">
            <form action="/lyq/admin/admin_cartselect" method="get">
                <table class="search-tab">
                    <tr>
                        <th width="70">关键字:</th>
                        <td><input class="common-text" placeholder="关键字" name="keywords" value="${param.keywords}" id="" type="text"></td>
                        <td><input class="btn btn-primary btn2" name="sub" value="查询" type="submit"></td>
                    </tr>
                </table>
            </form>
        </div>
    </div>
    <div class="result-wrap">
        <form action="/lyq/admin/admin_docartdel" id="myform" method="post">
            <div class="result-title">
                <div class="result-list">
                    <a id="batchDel" href="javascript:delmore('你确定要删除这些订单吗？','myform')"><i class="icon-font"></i>批量删除</a>
                </div>
            </div>
            <div class="result-content">
                <table class="result-tab" width="100%">
                    <tr>
                        <th class="tc" width="5%"><input class="allChoose" name="" onclick="selall(this)" type="checkbox"></th>
                        <th>ID</th>
                        <th>订单用户</th>
                        <th>订单用户名称</th>
                        <th>商品图片||商品名称</th>
                        <th>订单数量</th>
                        <th>订单总价格</th>
                        <th>操作</th>
                    </tr>
                    <%-- 从DoUserSelect页获取用户数据，进行循环--%>
                    <c:forEach var="c" items="${clist}">
                        <tr>
                            <td class="tc"><input name="id[]" value="${c.id}" type="checkbox"></td>
                            <td>${c.id}</td>
                            <td>${c.order_u_id}</td>
                            <td>${c.order_u_name}</td>
                            <td><img src="../shangc/image/product/${c.order_p_filename}" width="80" height="80">${c.order_p_name}</td>
                            <td>${c.order_quantity}</td>
                            <td>${c.order_p_price * c.order_quantity}</td>
                            <td>
                                <a class="link-del" href="javascript:prodel('你确定要删除订单【${c.id}】吗？','/lyq/admin/admin_docartdel?id=${c.id}&cp=${cpage}&keywords=${param.keywords}')">删除</a>
                            </td>
                        </tr>
                    </c:forEach>
                    <script>
                        //单条删除
                        function prodel(id,url) {
                            if (confirm(id)){
                                location.href=url}
                        }
                        //全选以及反选
                        function selall(obj) {
                            var a = document.getElementsByName("id[]");
                            for(var i=0;i<a.length;i++){
                                a[i].checked = obj.checked;
                            }
                        }
                        //批量删除
                        function delmore(mess,formname) {
                            if (confirm(mess)){
                                var j = 0;
                                var form =  document.getElementById(formname);
                                var a = document.getElementsByName("id[]");
                                for(var i=0;i<a.length;i++){
                                    if (a[i].checked == true){
                                        j++;
                                    }
                                }
                                if (j == 0) {
                                    alert('请进行勾选想删除的项目');
                                }else {
                                    form.submit();
                                }
                            }
                        }
                    </script>
                </table>
                <div class="list-page">
                    <a href="admin_cartselect?cp=1${searchParams}">首页</a>
                    <a href="admin_cartselect?cp=${cpage-1<1?1:cpage-1}${searchParams}">上一页</a>
                    共${total}条 ，当前 ${cpage}/${count} 页
                    <a href="admin_cartselect?cp=${cpage+1>count?count:cpage+1}${searchParams}">下一页</a>
                    <a href="admin_cartselect?cp=${count}${searchParams}">尾页</a>
                </div>
            </div>
        </form>
    </div>
</div>
<!--/main-->
</div>
</body>
</html>
